package br.inf.carlos.wfg2.gui.panels;

import java.io.File;

import br.inf.carlos.wfg2.gui.FrameBase;
import br.inf.carlos.wfg2.gui.actions.ButtonProcessarListener;


/**
 *
 * @author carlos
 */
public class PainelComponenteSaveConfiguracao extends javax.swing.JPanel
{
	private Class clazz;
	
	private FrameBase frameBase;
	
	public PainelComponenteSaveConfiguracao(Class clazz, FrameBase frameBase)
	{
		super();
		this.clazz = clazz;
		this.frameBase = frameBase;
		this.initComponents();
		this.carregaCamposPainel();
	}
	
	private void carregaCamposPainel()
	{
		String controller = this.getClazz().getSimpleName() + "Controller";
		this.controllerName.setText(controller);
		
		String classe = this.getClazz().getSimpleName();
		
		String views = "{\"/" + classe + "/\", \"/" + classe + "\"}";
		
		this.defaultView.setText	(views.toLowerCase());
		this.outputPackage.setText	("br.inf.carlos.teste.controllers");
		
	}

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents()
    {

        buttonProcessar = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        controllerName = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        outputPackage = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        defaultView = new javax.swing.JTextField();

        setBorder(javax.swing.BorderFactory.createEtchedBorder());

        buttonProcessar.setText("Processar");

        jLabel1.setText("Controller:");

        jLabel2.setText("Pacote do controlador:");

        jLabel3.setText("Default view:");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(controllerName, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addComponent(jLabel3))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(defaultView, javax.swing.GroupLayout.DEFAULT_SIZE, 187, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(outputPackage, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(buttonProcessar, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)) //129
                    .addComponent(jLabel2))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(10, 10, 10)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(controllerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(outputPackage, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(defaultView, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(buttonProcessar))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        
        ButtonProcessarListener listener = new ButtonProcessarListener(this.getFrameBase());
        
        this.buttonProcessar.addActionListener(listener);
    }


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonProcessar;
    private javax.swing.JTextField controllerName;
    private javax.swing.JTextField defaultView;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JTextField outputPackage;
    // End of variables declaration//GEN-END:variables

    
    public Class getClazz() {
		return clazz;
	}

	public void setClazz(Class clazz) {
		this.clazz = clazz;
	}

	public FrameBase getFrameBase() {
		return frameBase;
	}

	public void setFrameBase(FrameBase frameBase) {
		this.frameBase = frameBase;
	}

	public javax.swing.JButton getButtonProcessar() {
		return buttonProcessar;
	}

	public javax.swing.JTextField getControllerName() {
		return controllerName;
	}

	public javax.swing.JTextField getDefaultView() {
		return defaultView;
	}

	public javax.swing.JTextField getOutputPackage() {
		return outputPackage;
	}
}
